<?php
form_pr('cttEdit','','_response/call.php?get=Operative/client_contact','post');
$MDCTT = 'ED'; ?>
<div class="title">Novo Contacto</div>
<div id="ctt_pr"></div>
<table width="100%" cellpadding="2" cellspacing="1">
	<tr id="ClListaDoc" runat="server">
		<td colspan="2" align="left" valign="top" id="trLeftListaDocs" runat="server">
<div id="MNCL" class="Line">
<table width="100%"  border="0" cellpadding="1" cellspacing="0">
	<tr><td valign="bottom" align="center" width="120" valign="top">
		</td><td width="600" valign="top">
		<?php
		mn_field('hidden',$MDCTT,'ctt_ID',0,'10','10','True','" readonly="');
		echo 'Nome do contacto';
		echo '<br>';
		mn_field('text',$MDCTT,'ctt_Name','','100','60','True','');
		echo '<br>'; ?>
		<br/>
		Local:<br/><?php mn_field('text',$MDCTT,'ctt_Local','','100','60','True','');?><br/>
		Observações:<br/><?php mn_field('text',$MDCTT,'ctt_Obs','','255','60','True','');?>
	</td>
	<td width="300" rowspan="2" valign="top">
	<?php
	//================= Client Contact Box (Ctt) ================== ?>
	<table width="300"  border="0" cellpadding="2" cellspacing="1" bordercolor="#CCCCCC">
    <tr bgcolor="#BACCD1">
      <td>Contactos </td>
      <td bgcolor="#BACCD1">Disponibilidade:
	  <?php $Qur = "Contactavel;Incontactavel#0;1";
	  mn_field('hselect','ED','AvbMailing',0,$Qur,'','',''); ?></td>
    </tr>
    <tr>
      <td width="100" bgcolor="#DFE8EA">Tel. Fixo </td>
      <td width="200">
	  <?php echo mn_field('text',$MDCTT,'ctt_Phone1','','12','12','False','');?></td>
    </tr>
    <tr>
      <td bgcolor="#DFE8EA">Tel. MÓvel </td>
	  <td>
	  <?php echo mn_field('text',$MDCTT,'ctt_Mobile','','12','12','False','');?>
	  </td>
    </tr>
    <tr>
      <td bgcolor="#DFE8EA">Email:</td>
      <td>
	  <?php echo mn_field('text',$MDCTT,'ctt_Email','','50','35','False','');?>
	  </td>
    </tr>
      </table>
      <?php
      	$GETProm = $GLOBALS['MYT']->db_array("SELECT cpm_ID, cpm_Name FROM campaigns
      			INNER JOIN campaigns_attrib ON cpg_Campaign = cpm_ID
      				WHERE cpm_Flag = 2 AND cpg_Flag = 2 AND CURRENT_TIMESTAMP BETWEEN cpg_TStart AND cpg_TEnd
      				AND cpg_Origen0 = {$_SESSION[$SESSCD]}
      				AND cpg_Current > 0");
      	if (isset($GETProm[1]['cpm_ID'])) {
     $qr_Products = "SELECT cpg_ID AS ID, cpp_Name AS NAME FROM campaigns_products
     				INNER JOIN campaigns_attrib ON cpp_ID = cpg_Product
      				WHERE cpg_Campaign = {$GETProm[1]['cpm_ID']}
      				AND cpg_Flag = 2 AND CURRENT_TIMESTAMP BETWEEN cpg_TStart AND cpg_TEnd
      				AND cpg_Origen0 = {$_SESSION[$SESSCD]}
      				AND cpg_Current > 0";
      	echo $GETProm[1]['cpm_Name'].' ';
      	mn_field('select','ED','ctg_Chose','',$qr_Products,' ','','');
      	} ?>
	  </td>
	</tr>
	</table>
</div>
	<?php
	echo '<table width="100%"  border="0" cellspacing="5" cellpadding="1" bgcolor="#688F97">
      <tr>
        <td align="center">';
		mn_field('button','ED','PRCLSV','Guardar','12','12','False','SUBMIT" onclick="
				subform(\'cttEdit\',\'ctt_pr\');
				this.disabled=true;');
	echo '</td>
      </tr>
    </table>';
	 ?>

	</td>
</tr>
</table>
</form>